package com.lap.auth.application.menu.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

@Data
@Schema(description = "菜单树数据传输")
public class MenuNodeDto {

  @Schema(description = "唯一标识")
  private Integer id;

  @Schema(description = "父菜单")
  private Integer parentId;

  @Schema(description = "菜单类型:0-菜单,1-Iframe,3-外链,4-目录,6-功能")
  private Integer menuType;

  @Schema(description = "路由名称")
  private String name;

  @Schema(description = "路由路径")
  private String path;

  @Schema(description = "路由组件")
  private String component;

  @Schema(description = "路由定向")
  private String redirect;

  @Schema(description = "权限码")
  private String auths;

  @Schema(description = "路由排序")
  private Integer rank;

  @Schema(description = "菜单名称")
  private String title;

  @Schema(description = "菜单图标")
  private String icon;

  @Schema(description = "向右图标")
  private String extraIcon;

  @Schema(description = "进场动画")
  private String enterTransition;

  @Schema(description = "离场动画")
  private String leaveTransition;

  @Schema(description = "菜单激活")
  private String activePath;

  @Schema(description = "Iframe链接")
  private String frameSrc;

  @Schema(description = "Iframe加载动画")
  private boolean frameLoading;

  @Schema(description = "显示菜单")
  private boolean showLink;

  @Schema(description = "显示父菜单")
  private boolean showParent;

  @Schema(description = "缓存页面")
  private boolean keepAlive;

  @Schema(description = "标签页面")
  private boolean hiddenTag;

  @Schema(description = "固定标签页")
  private boolean fixedTag;

  @Setter
  @Getter(AccessLevel.NONE)
  @Schema(description = "子菜单")
  private List<MenuNodeDto> children;

  public List<MenuNodeDto> getChildren() {
    if (children == null) {
      children = new ArrayList<>();
    }
    return children;
  }
}
